import requestManager from "../utils/request.util";
import type { DeptRes, RemainListRes } from "../../types/appointment.type";

// 获取科室列表
export const getDeptList = () => {
  return requestManager.request<DeptRes[]>({
    url: "/appointment/getDeptList",
    method: "GET",
  });
};

// 查询诊所余号列表
export const getRemainList = (params: {
  deptId: number;
  visitDate: string;
}) => {
  return requestManager.request<RemainListRes[]>({
    url: "/appointment/getRemainList",
    method: "GET",
    data: params,
  });
};

// 发起预约
export const addAppointment = (params: {
  visitDate: string; //就诊日期;2025-07-09
  visitPeriod: string; //就诊时段;就诊时段1.上午2下午3晚上
  visitSeqNo: number; //排队序号;排队序号 1/2/3
  doctorId: number; //医生ID
  patientId: number; //患者ID（发起预约的时候给这个ID）
}) => {
  return requestManager.request<any>({
    url: "/appointment/addAppointment",
    method: "POST",
    data: params,
  });
};

// 取消预约
export const cancelAppointment = (params: {
  registerId: number; // 挂号ID
}) => {
  return requestManager.request<any>({
    url: "/appointment/cancelAppointment",
    method: "POST",
    data: params,
  });
};
